home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Workspace / Locus / Source / ItemCell.h < prev    next >
Text File  |  1995-06-12  |  4KB  |  193 lines

  1.  
  2. /*
  3.     Copyright 1993  Jeremy Slade.  All rights reserved.
  4. */
  5.  
  6. /*
  7.     Project: Locus
  8.     
  9.     Class: ItemCell
  10.     
  11.     Description: 
  12.  
  13.     Original Author: Jeremy Slade
  14.     
  15.     Revision History:
  16.         Created
  17.             V.101    JGS Mon Feb  8 22:33:12 GMT-0700 1993
  18.  
  19.  
  20. */
  21.  
  22.  
  23. #ifndef ItemCell_h
  24. #define ItemCell_h
  25.  
  26. #define ItemCell_VERSION         (101)
  27.  
  28.  
  29. #import <appkit/Cell.h>
  30. #import <appkit/NXImage.h>
  31. #import <objc/HashTable.h>
  32. #import <sys/param.h>
  33. #import <sys/types.h>
  34. #import <time.h>
  35.  
  36.  
  37. // File types ( fileType instance variable ) ----------------------------
  38. #define FT_UNKNOWN            0
  39. #define FT_APPLICATION        1
  40. #define FT_FILE                2
  41. #define FT_SUBDIR            3
  42.  
  43.  
  44. // -----------------------------------------------------------------
  45. //   Drawing Flags
  46. // -----------------------------------------------------------------
  47.  
  48. typedef struct {
  49.  
  50.     // General flags;
  51.     ushort mode;            // Current drawing mode
  52.     BOOL actualImage;        // Show Actual Image
  53.     
  54.     // Large Browse mode
  55.     BOOL lb_tridots;        // Show tridots for non-running apps
  56.     ushort lb_nameMode;        // Name mode -- eight possibilities
  57.     BOOL lb_info1;            // Show info line 1
  58.     BOOL lb_info2;            // Show info line 2
  59.     
  60.     // Small Browse mode
  61.     BOOL sb_icon;            // Show icon in Small Browser mode
  62.     ushort sb_nameMode;        // Name mode
  63.     
  64.     // Large Icon mode
  65.     BOOL li_showName;        // Show name
  66.     
  67.     // Small Icon mode
  68.     BOOL si_showName;        // Show name
  69.     
  70. } DrawInfo;
  71. #define DrawInfoTypeString    "{SccScccScc}"
  72.  
  73.  
  74. // Draw Modes ----------------------------------------------------------
  75. #define IC_DRAW_UNKNOWN        0
  76. #define IC_LARGE_BROWSE        1
  77. #define IC_SMALL_BROWSE        2
  78. #define IC_LARGE_ICON        3
  79. #define IC_SMALL_ICON        4
  80. extern const char *ICModeTitles[];
  81.  
  82. // Name Formats (for Browse modes) --------------------------------
  83. #define IC_NAME_UNKNOWN        0
  84. #define IC_FULLPATH            1
  85. #define IC_FILEANDPATH        2
  86. #define IC_FILEONLY            3
  87. #define IC_RELATIVE            4
  88. #define IC_NOPATH            5
  89. extern const char *ICFormatTitles[];
  90.  
  91.  
  92. @interface ItemCell : Cell
  93. {
  94.     char *path;            // Path specifier
  95.     char *fileStr;            // Formatted string for path
  96.     unsigned short fileType;
  97.     
  98.     // ItemCell flags
  99.     BOOL    isAutoLaunch;
  100.     BOOL    isGroupLaunch;
  101.     BOOL    specificApp;
  102.     BOOL    createBrowser;
  103.     BOOL    hideIcon;
  104.     BOOL    dynamic;
  105.     BOOL    needsUpdate;
  106.  
  107.     NXPoint        largeIconLoc;    // Location for Icon in Large Icon mode
  108.     NXPoint        smallIconLoc;    // Location for Icon in Small Icon mode
  109.  
  110.     char         *appName;    // Application used to open it
  111.     char        *rootAt;    // Path to root new browser at
  112.     
  113.     NXImage    *image;            // Image supplied by Workspace
  114.     NXImage    *actualImage;    // Actual contents of image Items
  115.     NXImage    *smallImage;    // 1/4 size icon
  116.     
  117.     id    group; // The group it belongs to
  118.  
  119. }
  120.  
  121. // Creating, intializing instances
  122. + initialize;
  123. - init;
  124. - initPath:(const char*)aPath;
  125. - free;
  126.  
  127. // Drawing
  128. + setDrawInfo:(const DrawInfo *)info;
  129. + getDrawInfo:(DrawInfo *)info;
  130. + (int)drawMode;
  131. - calcCellSize:(NXSize *)theSize;
  132. - drawSelf:(const NXRect *)cellFrame inView:controlView;
  133. - drawInside:(const NXRect *)cellFrame inView:controlView;
  134. - highlight:(const NXRect *)cellFrame inView:controlView lit:(BOOL)flag;
  135. - (BOOL)needsUpdate;
  136. - (int)state;
  137.  
  138. // Tracking
  139. - (BOOL)mouseDownAt:(const NXPoint *)startPt
  140.     frame:(const NXRect *)cellFrame
  141.     inView:controlView;
  142.  
  143. // Setting Attributes
  144. - setPath:(const char *)aPath;
  145. - resetFileStr;
  146. - setAutoLaunch:(BOOL)flag;
  147. - setGroupLaunch:(BOOL)flag;
  148. - getInfo;
  149. - getIcon;
  150. - (const char *)path;
  151. - (int)fileType;
  152. - (const char *)fileStr;
  153. - (const char *)filename;
  154. - (BOOL)isAutoLaunch;
  155. - (BOOL)isGroupLaunch;
  156. - (NXImage *)image;
  157. - (NXImage *)smallImage;
  158.  
  159. // Group
  160. - group;
  161. - setGroup:aGroup;
  162.  
  163. // File-type Items
  164. - setAppName:(const char *)aString;
  165. - (const char *)appName;
  166. - (BOOL)hasSpecificApp;
  167.  
  168. // Subdir-type Items
  169. - setCreateBrowser:(BOOL)flag;
  170. - rootBrowserAt:(const char*)fullpath;
  171. - (BOOL)createBrowser;
  172. - (const char *)browserRootedAt;
  173.  
  174. // App-type Items
  175. - setHideIcon:(BOOL)flag;
  176. - (BOOL)hideIcon;
  177.  
  178. // Dynamic Items
  179. - setDynamic:(BOOL)flag;
  180. - (BOOL)isDynamic;
  181.  
  182. // Launching
  183. - (BOOL)launch;
  184.  
  185. // Archiving
  186. - awake;
  187. - read:(NXTypedStream *)stream;
  188. - write:(NXTypedStream *)stream;
  189.  
  190. @end
  191.  
  192. #endif // ItemCell_h
  193.